package com.sdcqjy.mylibrary.widget;

import android.app.Dialog;
import android.content.Context;
import android.widget.TextView;

import com.lsjwzh.widget.materialloadingprogressbar.CircleProgressBar;
import com.sdcqjy.mylibrary.R;

/**
 *
 */
public class LoadDialog extends Dialog {
    private CircleProgressBar progressBar;

    public LoadDialog(Context context) {
        super(context, R.style.AlertDialogStyle);
        this.context = context;
        setCancelable(true);
        setCanceledOnTouchOutside(false);

        setContentView(R.layout.dialog_load);

        txt_loading = (TextView) findViewById(R.id.txt_loading);
        progressBar = (CircleProgressBar) findViewById(R.id.progressBar);
        //progressBar.setShowArrow(true);
        progressBar.setCircleBackgroundEnabled(false);
        progressBar.setColorSchemeResources(R.color.common_blue);
    }

    private Context context;
    private TextView txt_loading;

    public LoadDialog setColorSchemeResources(int... colorRes) {
        progressBar.setColorSchemeResources(colorRes);
        return this;
    }

    public LoadDialog textClear() {
        txt_loading.setText("正在加载...");
        return this;
    }

    public LoadDialog setText(String text) {
        txt_loading.setText(text);
        return this;
    }
}
